<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Commands::Plugin</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Commands::Plugin</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/vendor/rails/railties/lib/commands/plugin_rb.html">
                vendor/rails/railties/lib/commands/plugin.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000504">environment=</a>&nbsp;&nbsp;
      <a href="#M000503">new</a>&nbsp;&nbsp;
      <a href="#M000505">options</a>&nbsp;&nbsp;
      <a href="#M000506">parse!</a>&nbsp;&nbsp;
      <a href="#M000508">parse!</a>&nbsp;&nbsp;
      <a href="#M000507">split_args</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">environment</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">script_name</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">sources</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000503" class="method-detail">
        <a name="M000503"></a>

        <div class="method-heading">
          <a href="#M000503" class="method-signature">
          <span class="method-name">new</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000503-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000503-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 403</span>
403:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
404:       <span class="ruby-ivar">@environment</span> = <span class="ruby-constant">RailsEnvironment</span>.<span class="ruby-identifier">default</span>
405:       <span class="ruby-ivar">@rails_root</span> = <span class="ruby-constant">RailsEnvironment</span>.<span class="ruby-identifier">default</span>.<span class="ruby-identifier">root</span>
406:       <span class="ruby-ivar">@script_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">$0</span>) 
407:       <span class="ruby-ivar">@sources</span> = []
408:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000508" class="method-detail">
        <a name="M000508"></a>

        <div class="method-heading">
          <a href="#M000508" class="method-signature">
          <span class="method-name">parse!</span><span class="method-args">(args=ARGV)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000508-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000508-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 492</span>
492:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse!</span>(<span class="ruby-identifier">args</span>=<span class="ruby-constant">ARGV</span>)
493:       <span class="ruby-constant">Plugin</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">parse!</span>(<span class="ruby-identifier">args</span>)
494:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000504" class="method-detail">
        <a name="M000504"></a>

        <div class="method-heading">
          <a href="#M000504" class="method-signature">
          <span class="method-name">environment=</span><span class="method-args">(value)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000504-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000504-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 410</span>
410:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">environment=</span>(<span class="ruby-identifier">value</span>)
411:       <span class="ruby-ivar">@environment</span> = <span class="ruby-identifier">value</span>
412:       <span class="ruby-constant">RailsEnvironment</span>.<span class="ruby-identifier">default</span> = <span class="ruby-identifier">value</span>
413:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000505" class="method-detail">
        <a name="M000505"></a>

        <div class="method-heading">
          <a href="#M000505" class="method-signature">
          <span class="method-name">options</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000505-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000505-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 415</span>
415:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">options</span>
416:       <span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">o</span><span class="ruby-operator">|</span>
417:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">set_summary_indent</span>(<span class="ruby-value str">'  '</span>)
418:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">banner</span> =    <span class="ruby-node">&quot;Usage: #{@script_name} [OPTIONS] command&quot;</span>
419:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">define_head</span> <span class="ruby-value str">&quot;Rails plugin manager.&quot;</span>
420:         
421:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;&quot;</span>        
422:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;GENERAL OPTIONS&quot;</span>
423:         
424:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-r&quot;</span>, <span class="ruby-value str">&quot;--root=DIR&quot;</span>, <span class="ruby-constant">String</span>,
425:              <span class="ruby-value str">&quot;Set an explicit rails app directory.&quot;</span>,
426:              <span class="ruby-node">&quot;Default: #{@rails_root}&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-ivar">@rails_root</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">environment</span> = <span class="ruby-constant">RailsEnvironment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@rails_root</span>) }
427:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-s&quot;</span>, <span class="ruby-value str">&quot;--source=URL1,URL2&quot;</span>, <span class="ruby-constant">Array</span>,
428:              <span class="ruby-value str">&quot;Use the specified plugin repositories instead of the defaults.&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-ivar">@sources</span><span class="ruby-operator">|</span>}
429:         
430:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-v&quot;</span>, <span class="ruby-value str">&quot;--verbose&quot;</span>, <span class="ruby-value str">&quot;Turn on verbose output.&quot;</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">$verbose</span><span class="ruby-operator">|</span> }
431:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">on</span>(<span class="ruby-value str">&quot;-h&quot;</span>, <span class="ruby-value str">&quot;--help&quot;</span>, <span class="ruby-value str">&quot;Show this help message.&quot;</span>) { <span class="ruby-identifier">puts</span> <span class="ruby-identifier">o</span>; <span class="ruby-identifier">exit</span> }
432:         
433:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;&quot;</span>
434:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;COMMANDS&quot;</span>
435:         
436:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  discover   Discover plugin repositories.&quot;</span>
437:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  list       List available plugins.&quot;</span>
438:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  install    Install plugin(s) from known repositories or URLs.&quot;</span>
439:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  update     Update installed plugins.&quot;</span>
440:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  remove     Uninstall plugins.&quot;</span>
441:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  source     Add a plugin source repository.&quot;</span>
442:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  unsource   Remove a plugin repository.&quot;</span>
443:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  sources    List currently configured plugin repositories.&quot;</span>
444:         
445:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;&quot;</span>
446:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;EXAMPLES&quot;</span>
447:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  Install a plugin:&quot;</span>
448:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-node">&quot;    #{@script_name} install continuous_builder\n&quot;</span>
449:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  Install a plugin from a subversion URL:&quot;</span>
450:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-node">&quot;    #{@script_name} install http://dev.rubyonrails.com/svn/rails/plugins/continuous_builder\n&quot;</span>
451:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  Install a plugin and add a svn:externals entry to vendor/plugins&quot;</span>
452:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-node">&quot;    #{@script_name} install -x continuous_builder\n&quot;</span>
453:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  List all available plugins:&quot;</span>
454:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-node">&quot;    #{@script_name} list\n&quot;</span>
455:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  List plugins in the specified repository:&quot;</span>
456:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-node">&quot;    #{@script_name} list --source=http://dev.rubyonrails.com/svn/rails/plugins/\n&quot;</span>
457:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  Discover and prompt to add new repositories:&quot;</span>
458:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-node">&quot;    #{@script_name} discover\n&quot;</span>
459:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  Discover new repositories but just list them, don't add anything:&quot;</span>
460:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-node">&quot;    #{@script_name} discover -l\n&quot;</span>
461:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  Add a new repository to the source list:&quot;</span>
462:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-node">&quot;    #{@script_name} source http://dev.rubyonrails.com/svn/rails/plugins/\n&quot;</span>
463:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  Remove a repository from the source list:&quot;</span>
464:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-node">&quot;    #{@script_name} unsource http://dev.rubyonrails.com/svn/rails/plugins/\n&quot;</span>
465:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;  Show currently configured repositories:&quot;</span>
466:         <span class="ruby-identifier">o</span>.<span class="ruby-identifier">separator</span> <span class="ruby-node">&quot;    #{@script_name} sources\n&quot;</span>        
467:       <span class="ruby-keyword kw">end</span>
468:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000506" class="method-detail">
        <a name="M000506"></a>

        <div class="method-heading">
          <a href="#M000506" class="method-signature">
          <span class="method-name">parse!</span><span class="method-args">(args=ARGV)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000506-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000506-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 470</span>
470:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse!</span>(<span class="ruby-identifier">args</span>=<span class="ruby-constant">ARGV</span>)
471:       <span class="ruby-identifier">general</span>, <span class="ruby-identifier">sub</span> = <span class="ruby-identifier">split_args</span>(<span class="ruby-identifier">args</span>)
472:       <span class="ruby-identifier">options</span>.<span class="ruby-identifier">parse!</span>(<span class="ruby-identifier">general</span>)
473:       
474:       <span class="ruby-identifier">command</span> = <span class="ruby-identifier">general</span>.<span class="ruby-identifier">shift</span>
475:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">command</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^(list|discover|install|source|unsource|sources|remove|update|info)$/</span>
476:         <span class="ruby-identifier">command</span> = <span class="ruby-constant">Commands</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">command</span>.<span class="ruby-identifier">capitalize</span>).<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
477:         <span class="ruby-identifier">command</span>.<span class="ruby-identifier">parse!</span>(<span class="ruby-identifier">sub</span>)
478:       <span class="ruby-keyword kw">else</span>
479:         <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Unknown command: #{command}&quot;</span>
480:         <span class="ruby-identifier">puts</span> <span class="ruby-identifier">options</span>
481:         <span class="ruby-identifier">exit</span> <span class="ruby-value">1</span>
482:       <span class="ruby-keyword kw">end</span>
483:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000507" class="method-detail">
        <a name="M000507"></a>

        <div class="method-heading">
          <a href="#M000507" class="method-signature">
          <span class="method-name">split_args</span><span class="method-args">(args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000507-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000507-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 485</span>
485:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">split_args</span>(<span class="ruby-identifier">args</span>)
486:       <span class="ruby-identifier">left</span> = []
487:       <span class="ruby-identifier">left</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">shift</span> <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^-/</span>
488:       <span class="ruby-identifier">left</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">shift</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]
489:       <span class="ruby-keyword kw">return</span> [<span class="ruby-identifier">left</span>, <span class="ruby-identifier">args</span>]
490:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>